package chapter02

import chapter01.Student

/**
 *
 * @author cdhuangchao3
 * @date 2023/6/3 9:03 PM
 */
object Test07_DataType {
  def main(args: Array[String]): Unit = {
    val a1 = 3;

    val b2: Byte = 10 + 20
    val b3: Byte = (10 + 20).toByte

    val f1: Float = 1.23f

    // 5、空
    // 5.1 空值Unit
    def m1(): Unit = {
      println("m1被调用执行")
    }

    val a = m1()
    println("a: " + a)

    // 5.2 空引用Null
    //    val n:Int = null // error
    var zs:Student = new Student("zs", 20)
    zs = null
    println(zs)

    // 5.3 Nothing
    def m2(n: Int): Nothing = {
      throw new NullPointerException
    }

    val b = m2(1)
    println(b)
  }

}
